package com.jxw.utils;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;

/* loaded from: classes.dex */
public class ControlSyncInfo {
    public static final String ANDROID_APP_LIST = "app_list";
    public static final Uri CONTROL_ANDROID = Uri.parse("content://com.jxw.utils.provider/app_list_table");

    public static void saveAndroidEntrance(Context context, String str) {
        ContentValues contentValues = new ContentValues();
        contentValues.put("app_list", str);
        saveFixInfo(context, contentValues, CONTROL_ANDROID);
    }

    private static void saveFixInfo(Context context, ContentValues contentValues, Uri uri) {
        if (hasExist(context, uri)) {
            int update = context.getContentResolver().update(uri, contentValues, null, null);
            com.jxw.launcher.util.Logger logger = com.jxw.launcher.util.Logger.getLogger();
            logger.e("saveFixInfo update:" + update);
            return;
        }
        context.getContentResolver().insert(uri, contentValues);
    }

    public static String getAPPGKList(Context context) {
        return getQueryUri(context, CONTROL_ANDROID, "app_list");
    }

    private static String getQueryUri(Context context, Uri uri, String str) {
        com.jxw.launcher.util.Logger logger = com.jxw.launcher.util.Logger.getLogger();
        logger.e("getQueryUri uriString:" + uri + ",column:" + str);
        String str2 = "";
        try {
            Cursor query = context.getContentResolver().query(uri, null, null, null, null);
            if (query != null && query.getCount() > 0) {
                while (query.moveToNext()) {
                    str2 = query.getString(query.getColumnIndex(str));
                }
            }
            if (query != null) {
                query.close();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        com.jxw.launcher.util.Logger logger2 = com.jxw.launcher.util.Logger.getLogger();
        logger2.e("getQueryUri:" + str2);
        return str2;
    }

    /* JADX WARN: Code restructure failed: missing block: B:10:0x001c, code lost:
        r8.close();
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public static boolean hasExist(android.content.Context r8, android.net.Uri r9) {
        /*
            r0 = 0
            android.content.ContentResolver r1 = r8.getContentResolver()     // Catch: java.lang.Exception -> L1f
            r3 = 0
            r4 = 0
            r5 = 0
            r6 = 0
            r7 = 0
            r2 = r9
            android.database.Cursor r8 = r1.query(r2, r3, r4, r5, r6, r7)     // Catch: java.lang.Exception -> L1f
            r9 = 1
            if (r8 == 0) goto L1a
            int r1 = r8.getCount()     // Catch: java.lang.Exception -> L1f
            if (r1 >= r9) goto L19
            goto L1a
        L19:
            r0 = 1
        L1a:
            if (r8 == 0) goto L1f
            r8.close()     // Catch: java.lang.Exception -> L1f
        L1f:
            return r0
        */
        throw new UnsupportedOperationException("Method not decompiled: com.jxw.utils.ControlSyncInfo.hasExist(android.content.Context, android.net.Uri):boolean");
    }
}
